/**
 * Created by yanghaibo
 */
var activityManageFilterParam = {
    status: 0,
    type: 0
};
(function(doc, win) {

    // sui 页面就绪时间
    $(doc).on("pageInit", "#activityManageFilterPage", function(e, pageId, $page, isBack) {
        var resetFilter = sessionStorage.getItem("resetFilter");
        if(resetFilter){
            $('#activityManageFilterPage .filter-item').removeClass("selected");
            activityManageFilterParam = {
                status: 0,
                type: 0
            };
            sessionStorage.removeItem("resetFilter");
        }
    });


    // 选择
    $(doc).on('click','#activityManageFilterPage .filter-item',function(){
        if ($(this).hasClass("selected")) {
            $(this).removeClass("selected");
            var status = $(this).attr("status");
            if (status) {
                activityManageFilterParam.status = 0;
            } else {
                var type = $(this).attr("type");
                activityManageFilterParam.type = 0;
            }
        } else {
            $(this).addClass("selected").siblings().removeClass("selected");
            var status = $(this).attr("status");
            if (status) {
                activityManageFilterParam.status = parseInt(status);
            } else {
                var type = $(this).attr("type");
                activityManageFilterParam.type = parseInt(type);
            }
        }

    });

    // 重置
    $(doc).on('click','#activityManageFilterPage .header .right a',function(){
        $('#activityManageFilterPage .filter-item').removeClass("selected");
        activityManageFilterParam = {
            status: 0,
            type: 0
        };
    });


})(document, window);

